package com.itheima.mall.web.ums;

import com.itheima.mall.pojo.ums.UmsResourceCategory;
import com.itheima.mall.service.ums.UmsResourceCategoryService;
import com.itheima.mall.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("resourceCategory")
public class UmsResourceCategoryController {

    @Autowired
    UmsResourceCategoryService umsResourceCategoryService;

    @PostMapping("create")
    public R UmsResourceCategoryCreate(@RequestBody UmsResourceCategory umsResourceCategory){
        return umsResourceCategoryService.UmsResourceCategoryCreate(umsResourceCategory);
    }

    @PostMapping("delete/{id}")
    public R UmsResourceCategoryDelete(@PathVariable Long id){
        return umsResourceCategoryService.UmsResourceCategoryDelete(id);
    }

    @GetMapping("listAll")
    public R UmsResourceCategoryListAll(){
        return umsResourceCategoryService.UmsResourceCategoryListAll();
    }

    @PostMapping("update/{id}")
    public R UmsResourceCategoryUpdate(@PathVariable Long id, @RequestBody UmsResourceCategory umsResourceCategory){
        return umsResourceCategoryService.UmsResourceCategoryUpdate(id,umsResourceCategory);
    }

}